package edu.vt.ece.rt.benchmark.vacation;

import edu.vt.ece.rt.dstm.QObject;
import edu.vt.ece.rt.util.Logger.Logger;

public class Travel extends QObject{

	String id;
	int price;
	int total;
	int used;

	@Override
	public QObject clone() {
		return null;
	}

	@Override
	public String getId() {
		return id;
	}
	
	public void setId(String newId) {
		id = newId;
	}
	
	public int getPrice(){
		return price;
	}
	
	public void setPrice(int p) {
		price = p;
	}
	
	
	public int getTotal(){
		return total;
	}
	
	public void setTotal(int t) {
		total = t;
	}
	
	
	public int getUsed(){
		return used;
	}
	
	public void setUsed(int u) {
		used = u;
	}
	

	public boolean isAvailable() {
		return (total - used) > 0;
	}

	public void reserve() {
		used++;
	}

	public void checkItem() {
		if (getUsed() > getTotal()) {
			System.out.println("Insanity for "+getId());
		}
		Logger.debug(getId()+" currently used "+getUsed());
	}

	
	public void increment() {
		total++;
	}
	
	public void decrement() {
		if (isAvailable()) {
			total--;
		}
	}

}
